package review.chapter00;
import java.util.Scanner;
/**
 * Enjoy programming!!!
 * Time: 2021/12/17 -  16:31
 */
public class ClassExercise {
    public static void main(String[] args) {
        char flag;
        do {
            System.out.println("请输入一个数");
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int[] arrays = {10, 12, 45, 9};
            int[] newarr = new int[arrays.length + 1];

            for (int i = 0; i < arrays.length; i++) {
                newarr[i] = arrays[i];
            }
            newarr[arrays.length] = n;

            for (int i = 0; i < newarr.length - 1; i++) {
                for (int j = 0; i < newarr.length - j - 1; j++) {
                    if (newarr[j] > newarr[j + 1]) {
                        int temp = newarr[j];
                        newarr[j] = newarr[j + 1];
                        newarr[j + 1] = temp;
                    }
                }
            }

            for (int e : newarr) {
                System.out.printf("%d ", e);
            }
            System.out.println("要继续吗？Y/N");
            flag = in.next().charAt(0);

//            int[] anewarr =
        }
        while(flag=='Y');

    }
//    public int[] getnewArray(int[] old){
//        int[] arr =
//        for (int i = 0; i < old.length; i++){
//
//        }

//    }
}

